pub struct CmdOption {
    pub abbr    :   String,
    pub full    :   String,
    pub vari    :   String,
    pub defa    :   String,
    pub desc    :   String,
}

pub fn options(args: &[String], long_option: &CmdOption) -> String {
    let mut flags = long_option.defa.clone();
    for (i, v) in args.iter().enumerate() {
        if [&long_option.abbr, &long_option.full].contains(&v) {
            flags = long_option.vari.clone();
            if i + 1 < args.len() && !args[i + 1].starts_with('-') {
                flags = args[i + 1].clone();
            }
        }
    }
    return flags;
}

pub fn set_options(args: &[String], long_option: &CmdOption) -> bool {
    let mut flags = false;
    for v in args {
        if [&long_option.abbr, &long_option.full].contains(&v)  {
            flags = true;
        }
    }
    return flags;
}

pub fn find_options(args: &[String], long_options: &[CmdOption], abr: &String ) -> String {
    let mut flags = String::new();
    for long_option in long_options {
        if abr == &long_option.abbr {
            flags = options(&args, &long_option);
        }
    }
    return flags;
}
